package visualizer.input.concrete;

import java.util.LinkedList;

import processing.core.PApplet;
import processing.core.PGraphics;
import processing.core.PImage;
import processing.core.PVector;
import visualizer.App;
import visualizer.controller.InputController;
import visualizer.input.Component;
import visualizer.input.ComponentCollection;

public class HeaderComponent extends ComponentCollection {
	private PImage background;
	
	public HeaderComponent(final App a, final InputController ic) {
		super(new PVector(0,0), new LinkedList<Component>() {{
			// Left input button
			add(new TextInputComponent(new PVector(217, 200), new PImage[] {
				a.loadImage("images/inputs/left2.png"),
				a.loadImage("images/inputs/lefthover.png"),
				a.loadImage("images/inputs/leftpressed.png")
			}, ic.getLeftSearchTermInput(), a));
			// Right input button
			add(new TextInputComponent(new PVector(572, 200), new PImage[] {
				a.loadImage("images/inputs/right2.png"),
				a.loadImage("images/inputs/righthover.png"),
				a.loadImage("images/inputs/rightpressed.png")
			}, ic.getRightSearchTermInput(), a));
			// Submit button
			add(new ButtonComponent(new PVector(911, 175), new PImage[] {
				a.loadImage("images/inputs/newstart.png"),
				a.loadImage("images/inputs/newstarthover.png"),
				a.loadImage("images/inputs/newstartpressed_03.png")
			}, ic.getSubmitButtonInput()));
		}});
		
		this.background = a.loadImage("images/header.png");
	}
	
	protected void drawRelative(PGraphics g) {
		g.image(background, 0, 0);
		super.drawRelative(g);
	}
}
